package com.imooc.mapping.course4.copier;

import com.imooc.mapping.course4.DateMapper;
import com.imooc.mapping.course4.Metadata;
import org.mapstruct.MapMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 *
 *
 * 集合和对象转换
 *
 * 集合和集合转换和数据类型转化
 *
 * 集合拷贝
 *
 */
@Mapper(uses = DateMapper.class)
public interface MetadataCopier {
    MetadataCopier INSTANCE = Mappers.getMapper(MetadataCopier.class);

    @Mapping(source = "en", target = "enName")
    Metadata metadataCopier(Map<String,String> map);

    //2025/11/12 11:13:45
    @MapMapping(valueDateFormat = "yyyy/MM/dd HH:mm:ss")
    Map<String, Date> longString2StringString(Map<Long, String> map);

    Set<Integer> string2IntegerSet(Set<String> strings);

    List<Metadata> copyList(List<Metadata> metadatas);
    Metadata copy(Metadata metadata);
}
